package com.qian.service.ddj.entity;

import com.yaowk.service.system.entity.SysUser;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Set;

@Getter
@Setter
@ToString
@Entity
@DynamicUpdate
@DynamicInsert
public class DdjUser extends SysUser {

    @ColumnDefault("0")
    @Column(nullable = false)
    private BigDecimal balance; // 余额
    @Column(columnDefinition = "LONGTEXT")
    private String secretKey; // 私钥
    @Column(columnDefinition = "LONGTEXT")
    private String publicKey;//公钥
    private String cardBank; // 银行
    private String cardNo; // 银行卡号
    private String cardPerson; // 持卡人
    private String cardPhone; // 预留手机号
    @ColumnDefault("0")
    private Byte isSend; // 是否发送推送
    @ColumnDefault("0")
    private Byte isAutoCash; // 是否自动提现
    @ColumnDefault("0")
    private Byte isAutoDf;//是否自动代付
    @ColumnDefault("0")
    @Column(nullable = false)
    private BigDecimal notifyBalance; // 下一次提示余额
    @ColumnDefault("0")
    @Column(nullable = false)
    private BigDecimal notifyCycle; // 提示周期
    @ColumnDefault("0")
    @Column(nullable = false)
    private BigDecimal autoCashBalance; // 自动提现余额
    private String remark; // 备注
    private String email;
    private String name; // 姓名
    private String phone; // 手机号
    private String idCard; // 身份证号码
    @ColumnDefault("0")
    private BigDecimal lockMoney;
    @ColumnDefault("0")
    private BigDecimal dfFee;

    @Column(insertable = false,updatable = false)
    private Integer dfBusinessId;

    @ManyToMany
    @JoinTable(name = "ddj_user_business", joinColumns = {@JoinColumn(name = "userId", referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "businessId", referencedColumnName = "id")})
    private Set<DdjBusiness> businesses;

    @ManyToOne
    @JoinColumn(name = "dfBusinessId")
    private DdjDfBusiness ddjDfBusiness;
}
